<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class Game extends CI_Controller {
	
	function __construct(){
		parent::__construct();
		$this->load->model('games');
		$this->load->library('session');
		
	}
	function index(){
		$players = $this->PLAYER->getPlayers();
		$data['players'] = $players;
		$this->load->view("header");
		$this->load->view("game",$data);
		$this->load->view("footer");
	}

	function removeAllRevealedCards(){
		$this->games->removeAllRevealedCards();
	}
	
	function printGameInfo(){
		print_r($this->games->getInfo());
	}
	function createNewGame(){
		echo $this->games->createNewGame();
	}
	function getCurrentGameId(){
		echo $this->session->userdata('gameId');
	}
	
	function endGame(){
		$this->games->endCurrentGame();
		//redirect('index.php?/player');
	}
	
	function createNewMasterSuit(){
		echo json_encode($this->games->createNewMasterSuit());//should return a talon object that has updated value
	}
	
	function setCurrentGameId($gameId){
		//echo $gameId;
		$this->games->setCurrentGameId($gameId);
	}
}
?>